package com.business.dynamic.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.business.common.dto.R;
import com.business.dynamic.entity.DynamicImages;
import com.business.dynamic.mapper.DynamicImagesMapper;
import com.business.dynamic.service.DynamicImagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 动态图片:业务接口实现类
 *
 * @author chenjiehong
 * @date 2019-12-03 09:24:15
 * @since 1.0
 */
@Service
public class DynamicImagesServiceImpl implements DynamicImagesService {

    @Autowired
    private DynamicImagesMapper dynamicImagesMapper;


    @Override
    @Transactional
    public Integer addList(List<DynamicImages> dynamicImagesList) {
        dynamicImagesList.forEach(dynamicImages -> {
            dynamicImagesMapper.insert(dynamicImages);
        });
        return 1;
    }

    @Override
    @Transactional
    public Integer deleteList(Integer dynamicId) {
        return dynamicImagesMapper.delete(new EntityWrapper<DynamicImages>().eq("dynamic_id", dynamicId));
    }
}